import * as MathUtils from '../Math/MathUtils'
import { Vector3 } from '../Math/Vector3'
import { getStream } from '../Core/connect'

export class Flatten {
    uuid: string
    height:number
    pointList:Array<Vector3>
    constructor(height:number,pointList:Array<Vector3>) {
        this.uuid = MathUtils.generateUUID()
        this.height = height
        this.pointList = pointList
        this.init()
    }
    init() {
        const stream = getStream()
        const str = {
            FlattenFunction: 'creatFlatten', 
            pointList :this.pointList,
            ids:this.uuid,
            height:String(this.height)
        }
        stream.emitUIInteraction(str)
    }

    destroy() {
        const stream = getStream()
        const str = { FlattenFunction: 'deldeteFlatten', ids: `${this.uuid}` }
        stream.emitUIInteraction(str)
    }
}
export function clearAllFlatten(){
    const stream = getStream()
    const str = { FlattenFunction: 'clearAllFlatten' }
    stream.emitUIInteraction(str)
}
